<?php
header('content-type:text/html;charset=utf-8');
header("Access-Control-Allow-Origin:*");

$server = 'localhost:3306';
$product = $price = $image = 'root';
$dbname = 'chanpin';

$conn = mysqli_connect($server, $product, $price, $dbname);

mysqli_set_charset($conn, 'utf8'); //解决数据库中文乱码

if (!$conn) {
    die('数据库连接失败');
}
